package cn.wolfcode.domain;

import cn.wolfcode.MyEnum.NoticeEnum;
import com.alibaba.fastjson.JSON;
import lombok.Getter;
import lombok.Setter;

import java.util.Date;
import java.util.HashMap;

@Getter
@Setter
public class Notice {
    /** */
    private Long id;

    /** 标题名*/
    private String title;

    /** 创建人*/
    private Employee creation;

    /** 创建时间*/
    private Date creationTime;

    /** 公告等级*/
    private Integer level;

    /** 发布状态*/
    private boolean status;

    /** 文本内容*/
    private String text;

    /** 多久没看公告了*/
    private  String intervalTime;

    public String getLevelName(){
        return NoticeEnum.findName(level);
    }

    public String toJson(){
        HashMap<String, Object> map = new HashMap<>();
        map.put("id",id);
        map.put("title",title);
        map.put("textValue",text);
        map.put("level",level);
        return JSON.toJSONString(map);
    }
}